<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站后台管理系统</title>
<meta name="keywords" content="">
<meta name="description" content="">
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="css/ie6.css"/>
<![endif]-->
<link rel="stylesheet" type="text/css"  href="../../../../Public/admin/css/style_v2.0.css"/>
<link rel="stylesheet" type="text/css"  href="../../../../Public/layui/css/layui.css">
<link rel="stylesheet" type="text/css"  href="__PUBLIC__/admin/css/style_v2.0.css"/>
<link rel="stylesheet" type="text/css"  href="__PUBLIC__/layui/css/layui.css">
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
</head>
<body>
<div class="position mt10">当前位置：<a href="{:U('Index/main')}">后台首页</a>  > <a href="{:U('Host/host')}">虚拟主机</a>  > 虚拟主机信息修改</div>
<div id="container">
  <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
      <legend>虚拟主机信息修改</legend>
  </fieldset>
  
<div class="c"></div> 
<form name=reg action="{:U('Admin/Host/host_update',array('hid' => $data['hid']))}"  enctype="multipart/form-data"  method="post"  class="layui-form" id="host_add">
<div class="layui-form">
    <table class="layui-table">
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>主机名称：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="hostname" type="text" id="hostname" value="{$data.hostname}" required  lay-verify="" placeholder="主机名称" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
     <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>绑定域名：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="hosturl" type="text" id="hosturl" value="{$data.hosturl}" required  lay-verify="" placeholder="绑定域名" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>解析IP：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="hostip" type="text" id="hostip" value="{$data.hostip}"  lay-verify="" placeholder="解析IP" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>主机别名：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="cname" type="text" id="cname" value="{$data.cname}"   lay-verify="" placeholder="主机别名" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>所属账号：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;">
          <select name="aid" lay-verify="" lay-filter="">
          <option value="">请选择账号</option>
           <volist name="account" id="a">
           <option value="{$a.aid}" <if condition="$data['aid'] eq $a['aid']">selected</if>>{$a.aname}</option>
           </volist>
        </select>
      </span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>所在机房：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="jifang" type="text" id="jifang" value="{$data.jifang}"   lay-verify="" placeholder="所在机房" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>操作系统：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="hostos" type="text" id="hostos" value="{$data.hostos}"   lay-verify="" placeholder="操作系统" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
     <tr>
	  <td width="20%" align="right">状态：</td>
	  <td width="80%">
      <span class="table_span" style="float:left;">
      <input type="radio" name="status" value="1" title="正常运行" <if condition="$data['status'] eq 1">checked</if>> &nbsp;&nbsp;&nbsp; 
      <input type="radio" name="status" value="0" title="已停止" <if condition="$data['status'] eq 0">checked</if>>&nbsp;&nbsp;&nbsp; 
      <input type="radio" name="status" value="2" title="临时关闭" <if condition="$data['status'] eq 2">checked</if>>&nbsp;&nbsp;&nbsp; 
      </span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>主机时间：</td>
	  <td width="80%">
      <span class="table_span" style="float:left;">
      <input name="hoststart" type="text" id="hoststart" value="{$data.hoststart|date='Y-m-d', ###}"  placeholder="开始日"  class="layui-input ico-date"  style="width:120px; float:left;">
      </span>
      <span class="table_span">~</span>
      <input name="hostend" type="text" id="hostend" value="{$data.hostend|date='Y-m-d', ###}"  placeholder="结束日" class="layui-input ico-date"  style="width:120px; float:left;">
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right"><font color=red size="1">·</font>空间大小：</td>
	  <td width="80%">
      <span class="table_span" style="width:300px; float:left;"><input name="space" type="text" id="space" value="{$data.space}"   lay-verify="" placeholder="空间大小(M)" autocomplete="off" class="layui-input"></span>
      <span class="table_txt"></span>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right">FTP账号：</td>
	  <td width="80%">
       <div class="fee_box"><span class="table_txt">FTP地址：</span><span style="width:280px; float:left;"><input name="ftp[0]" type="text" id="ftp" value="{$ftp['0']}"  autocomplete="off" class="layui-input" placeholder="" ></span>
       <span class="table_txt">端口：</span><span style="width:60px; float:left;"><input name="ftp[1]" type="text" id="ftp" value="{$ftp['1']}"  autocomplete="off" class="layui-input" placeholder="" ></span>
       </div>
       <div class="fee_box"><span class="table_txt">FTP账号：</span><span style="width:280px; float:left;"><input name="ftp[2]" type="text" id="ftp" value="{$ftp['2']}"  autocomplete="off" class="layui-input" placeholder="" ></span></div>
       <div class="fee_box"><span class="table_txt">FTP密码：</span><span style="width:280px; float:left;"><input name="ftp[3]" type="text" id="ftp" value="{$ftp['3']}"  autocomplete="off" class="layui-input" placeholder="" ></span></div>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right">数据库账号：</td>
	  <td width="80%">
       <div class="fee_box"><span class="table_txt">数据库地址：</span><span style="width:280px; float:left;"><input name="database[0]" type="text" id="database" value="{$database['0']}"  autocomplete="off" class="layui-input" placeholder="" ></span>
       <span class="table_txt">端口：</span><span style="width:60px; float:left;"><input name="database[1]" type="text" id="database" value="{$database['1']}"  autocomplete="off" class="layui-input" placeholder="" ></span>
       </div>
       <div class="fee_box"><span class="table_txt">数据库名称：</span><span style="width:280px; float:left;"><input name="database[2]" type="text" id="database" value="{$database['2']}"  autocomplete="off" class="layui-input" placeholder="" ></span></div>
       <div class="fee_box"><span class="table_txt">数据库账号：</span><span style="width:280px; float:left;"><input name="database[3]" type="text" id="database" value="{$database['3']}"  autocomplete="off" class="layui-input" placeholder="" ></span></div>
       <div class="fee_box"><span class="table_txt">数据库密码：</span><span style="width:280px; float:left;"><input name="database[4]" type="password" id="database3" value="{$database['4']}"  autocomplete="off" class="layui-input" placeholder="" >
        <input name="showpwd2" type="text" id="showpwd2" value="" style="display:none;" class="layui-input" placeholder="">
       </span>
       <span class="ico_eye" id="look_database">&nbsp;</span>
       </div>
      </td>
    </tr>
    <tr>
	  <td width="20%" align="right">控制面板：</td>
	  <td width="80%">
       <div class="fee_box"><span class="table_txt">面板账号：</span><span style="width:280px; float:left;"><input name="panel[0]" type="text" id="panel" value="{$panel['0']}"  autocomplete="off" class="layui-input" placeholder="" ></span></div>
       <div class="fee_box"><span class="table_txt">登录账号：</span><span style="width:280px; float:left;"><input name="panel[1]" type="text" id="panel" value="{$panel['1']}"  autocomplete="off" class="layui-input" placeholder="" ></span></div>
       <div class="fee_box"><span class="table_txt">登录密码：</span><span style="width:280px; float:left;"><input name="panel[2]" type="password" id="panel2" value="{$panel['2']}"  autocomplete="off" class="layui-input" placeholder="" >
       <input name="showpwd3" type="text" id="showpwd3" value="" style="display:none;" class="layui-input" placeholder="">
       </span>
       <span class="ico_eye" id="look_panel">&nbsp;</span>
       </div>
      </td>
    </tr>
    <tr>
	     <td align="right">排序：</td>
	     <td><span class="table_txt"><input type="text" name="listorder" value="{$data.listorder}" class="layui-input" style="width:50px;"></span>
            <span class="table_txt"><font color="#666666">（越大越靠前）</font></span></td>
      </tr>
	  <td align="right"><font color=red size="1">·</font>添加时间：</td>
	  <td><input name="inputtime" type="text" id="inputtime" value="{$data.inputtime|date='Y-m-d H:i:s',###}"  autocomplete="off" class="layui-input ico-date"  style="width:250px; float:left;"></td>
	  </tr>
    <tr> 
	  <td colspan=2 align="center" valign="middle">
		<input type="submit" name="Submit" value="确&nbsp; &nbsp;定" class="layui-btn" >
		<input type="reset" name="Submit2" value="重　置" class="layui-btn layui-btn-primary" >		 </td>
	</tr>
    </table>
</div>
</form>
</div>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
</body>
</html>
<script>
//Demo
layui.use(['form','laydate'], function(){
  var form = layui.form
  ,laydate = layui.laydate;
   //,layer = layui.layer
  laydate.render({
    elem: '#inputtime'
	,type: 'datetime'
  });
  laydate.render({
    elem: '#hoststart'
  });
  laydate.render({
    elem: '#hostend'
  });
   
   form.verify({
        groupname: function(value){
		    if(value !="" || value.length  >0){
			    
			}else{
			   return '请填写分组名称';
			}
		}   
	   ,listorder: function(value){
	       if(value != ""){
			   if(!new RegExp(/^\d*$/).test(value)){
		            return '必须是数字0';
		       }
		   }
	   }
   });
   
   
  //监听提交
  form.on('submit(formSearch)', function(data){
    //layer.msg(JSON.stringify(data.field));
	title: '最终的提交信息'
	return true;
  });
  
  /*查看数据库密码*/
  $("#look_database").click(function(){
      var loginpwd = prompt('请输入查看密码(后台登录密码)','');
	  //console.log(loginpwd);
	  if(loginpwd.length >0 && loginpwd != ""){
		  $.ajax({
			  url:"{:U('Host/check_pwd')}",
			  dataType:"json",
			  data:{'password': loginpwd },
			  type:'post',
			  success:function(data){
				 console.log(data);
				 if(data){
					 $("#database3").hide();
					 $("#showpwd2").val($("#database3").val()).show();
					  var timer = setTimeout(function(){
									  $("#database3").show();
									  $("#showpwd2").hide();
								  }, 3000);
					 /*查看密码*/
				 }else{
					 alert("你无权查看");
				 }
			  },
		   })
	   }
	});
  /*查看控制面板密码*/
  $("#look_panel").click(function(){
	  $("#panel2").hide();
	  $("#showpwd3").val($("#panel2").val()).show();
	  var timer = setTimeout(function(){
					  $("#panel2").show();
					  $("#showpwd3").hide();
				  }, 3000);
     });

});

</script>